<?php
namespace app\index\controller;
use think\Controller;
class Detail extends Controller
{
    public function index()
    {
        if(!session('blog_user','','blog')){
            $this->error('请您先登录',url('index/user/login'));
        }
        $id = input('get.id');

        $data = model('Releases')->dataById($id);
        //通过user_id获取用户名
        $user_id = $data[0]['user_id'];
        $rel = model('User')->usernameById($user_id)->toArray();
        $data[0]['user_id'] = $rel[0]['username'];


        if(!$data ){
            $this->error('商品不存在');
        }
        $data = $data->toArray();


        return $this->fetch('',[
            'data'=>$data
        ]);
    }



}
